from django.conf.urls import url
from django.contrib import admin
from django.urls import path
from rest_framework_jwt.views import obtain_jwt_token

from . import views

urlpatterns = [
    # 1.用户名注册查询
    url(r'^usernames/(?P<username>\w{5,20})/count/$', views.UsernameCountView.as_view()),
    # 2.手机号注册查询
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCountView.as_view()),
    # 3.手机验证码发送
    url(r'^sms_codes/(?P<mobile>1[3-9]\d{9})/$', views.SMSCodeView.as_view()),
    # 4.用户注册
    url(r"^users/$",views.UserView.as_view()),
    # 5.用户登录 jwt中的视图函数
    # url(r'^authorizations/$', obtain_jwt_token), 合并购物车重写登录接口
    url(r'^authorizations/$', views.ObtainJSONWebToken.as_view()),
    # 6.qq登录返回请求路径
    url(r'^oauth/qq/authorization/$', views.QQAuthURLView.as_view()),
    # 7.get用户请求后台qq用户后台是否已经绑定，post进行绑定
    url(r'^oauth/qq/user/$', views.QQAuthUserView.as_view()),
    # 8.个人中心
    url(r"^user/$",views.UserDetailView.as_view()),
    # 9.用户浏览历史
    # 10.邮箱链接发送
    url(r"^email/$", views.EmailView.as_view()),
    # 11.点击验证邮箱
    url(r'^emails/verification/$', views.EmailVerifyView.as_view()),
    # 12.省级地址获取
    url(r'^areas/$', views.AreasView.as_view()),
    # 13.市区县级地址获取
    url(r'^areas/(?P<pk>\d+)/', views.AreaView.as_view()),
    # 14.用户地址的增删改查
    url(r'^addresses/$', views.AddressView.as_view()),
    url(r'^addresses/(?P<pk>\d+)/$', views.AddressView.as_view()),
    # 15.改标题title
    url(r'^addresses/(?P<pk>\d+)/title/$', views.AddressTitleView.as_view()),
    # 16.设置未默认地址
    url(r'^addresses/(?P<pk>\d+)/status/$', views.AddressDefaultView.as_view()),
    # 17.用户浏览商品记录接口/browse_histories/
    url(r'^browse_histories/$', views.GoodHistoryView.as_view()),

]